<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8" %>
<%@ include file="../../include/admincontent.jsp" %>
<div id="Content">
    <!-- 筛选条件 -->
    <div id="searchbox">
        <form id="sform">
            <table class="treeTable searchform">
                <thead>
                <tr>
                    <td width="60">部门名称：</td>
                    <td width="150">
                        <div><input type="text" name="deptname"/></div>
                    </td>
                    <td width="60">岗位名称：</td>
                    <td width="150">
                        <div><input type="text" name="jobname"/></div>
                    </td>
                    <td width="30">
                        <button id="searchbtn" type="button" class="search"></button>
                    </td>
                    <td></td>
                </tr>
                </thead>
            </table>
        </form>
    </div>
    <table class="treeTable" id="tablelist">
        <thead>
        <tr>
            <td width="30">序号</td>
            <td width="200">岗位名称</td>
            <td>部门名称</td>
            <td width="60">选择</td>
        </tr>
        </thead>
        <tbody id="result"></tbody>
    </table>
    <div id="page"></div>
</div>

<script type="text/javascript">
    $(document).ready(function () {
        getList();
        $('#searchbtn').click(function () {
            getList();
        });
        $(document).delegate('#result a', 'click', function () {
            parent.$('input[name=jobcode]').val($(this).prev().val());
            parent.$('input[name=jobname]').val($(this).parent().prev().prev().text());

            var index = parent.layer.getFrameIndex(window.name);
            parent.layer.close(index);
        });
    });

    function getList() {
        $('#page').myPagination({
            cssStyle: "pagination",
            ajax: {
                on: true,
                url: '/Do/AssignPosition/getjobs',
                param: $('#sform').serialize(),
                dataType: 'html',
                callback: function (data) {
                    $('#result').html(data);
                }
            }
        });
    }

</script>
</body>
</html>